<%--
  Created by IntelliJ IDEA.
  User: chris
  Date: 17-5-11
  Time: 上午12:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/header.jsp" %>
<form class="layui-form base">
    <div class="layui-form-item">
        <label class="layui-form-label">订单号</label>
        <div class="layui-input-block">
            <input type="text" disabled value="${purchase.id}" name="id" lay-verify="title"
                   autocomplete="off"
                   placeholder="请输入标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">客户名</label>
        <div class="layui-input-block">
            <input type="text" disabled value="${purchase.croCustomer.username}" name="username"
                   lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">收货人名</label>
        <div class="layui-input-block">
            <input type="text" readonly value="${purchase.croAddress.consignee}" name="consignee"
                   lay-verify="required" placeholder="请输入" autocomplete="off" class="consignee layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">订单类型</label>
            <div class="layui-input-inline">
                <select name="orderType" class="orderType">
                    <option value="${purchase.orderType}">${SysDict['order_type'][purchase.orderType]}</option>
                    <c:forEach items="${SysDict['order_type']}" var="type">
                        <c:if test="${purchase.orderType != type.key}">
                            <option value="${type.key}">${type.value}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </div>
            <label class="layui-form-label">支付类型</label>
            <div class="layui-input-inline">
                <select name="paytype" class="paytype">
                    <option value="${purchase.paytype}">${SysDict['pay_type'][purchase.paytype]}</option>
                    <c:forEach items="${SysDict['pay_type']}" var="pay">
                        <c:if test="${purchase.paytype != pay.key}">
                            <option value="${pay.key}">${pay.value}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </div>
            <label class="layui-form-label">订单状态</label>
            <div class="layui-input-inline">
                <select name="orderStatus" class="orderStatus">
                    <option value="${purchase.orderStatus}">${SysDict['order_status'][purchase.orderStatus]}</option>
                    <c:forEach items="${SysDict['order_status']}" var="status">
                        <c:if test="${purchase.orderStatus != status.key}">
                            <option value="${status.key}">${status.value}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">创建时间</label>
            <div class="layui-input-inline">
                <input type="text" value="${purchase.createdate}" disabled name="cretedata"
                       lay-verify="required" placeholder="创建时间" autocomplete="off" class="layui-input"
                       onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
            </div>
            <label class="layui-form-label">下单时间</label>
            <div class="layui-input-inline">
                <input type="text" value="${purchase.orderdate}" disabled name="orderdata"
                       lay-verify="required" placeholder="下单时间" autocomplete="off" class="layui-input"
                       onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <input type="text" name="addressId" class="addressId hidden" hidden value="${purchase.croAddress.id}">
        <label class="layui-form-label">客户地址</label>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" readonly value="${purchase.croAddress.country.name}" required name="country"
                       lay-verify="required" placeholder="国家" autocomplete="off" class="country layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" readonly value="${purchase.croAddress.provience.name}" required name="provience"
                       lay-verify="required" placeholder="省份" autocomplete="off" class="provience layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" readonly value="${purchase.croAddress.city.name}" name="city" required lay-verify="required"
                       placeholder="城市" autocomplete="off" class="city layui-input">
            </div>
            <label class="layui-form-label">邮政编码</label>
            <div class="layui-input-inline">
                <input type="text" readonly value="${purchase.croAddress.postcode}" required name="postcode"
                       lay-verify="required"
                       placeholder="邮政编码" autocomplete="off" class="postcode layui-input">
            </div>
            <div class="layui-input-inline">
                <a class="layui-btn layui-btn-warm" id="changeAddr" custId="${purchase.croCustomer.id}" >更换地址</a>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详细地址</label>
        <div class="layui-input-block">
            <input type="text" readonly value="${purchase.croAddress.address}" name="address" required lay-verify="required"
                   placeholder="详细地址" autocomplete="off" class="address layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注信息</label>
        <div class="layui-input-block">
            <textarea type="text" name="notes" placeholder="备注信息" autocomplete="off" class="layui-textarea">${purchase.notes}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <a class="layui-btn" lay-submit="update-purchase" lay-filter="update-purchase">立即提交</a>
            <a class="layui-btn closeFull layui-btn-normal">关闭</a>
        </div>
    </div>
</form>
<form class="layui-form addr_form" hidden>
    <br>
    <div class="layui-form-item" style="padding: 0 10px;">
        <label class="layui-form-label">请选择地址</label>
        <div class="layui-input-block">
            <select id="addr_select">
                <option value="">地址</option>
            </select>
        </div>
    </div>
</form>